﻿<template>
  <div class="components-container">
    <div class="header-form">
      <div class="layui-inline">
        <label class="layui-form-label">业务编号</label>
        <div class="layui-input-inline">
          <el-input v-model="selectData.RegbussnumLike" placeholder="请输入业务编号"></el-input>
        </div>
      </div>

      <div class="layui-inline">
        <label class="layui-form-label">火化日期</label>
        <el-date-picker
          v-date
          v-model="selectData.RegcremationdateGreaterAndEquals"
          type="date"
          placeholder="选择日期范围"
        ></el-date-picker>
        <el-date-picker
          v-date
          v-model="selectData.RegcremationdateLessAndEquals"
          type="date"
          placeholder="选择日期范围"
        ></el-date-picker>
      </div>
      <div class="layui-inline">
        <label class="layui-form-label">统计地点</label>
        <div class="layui-input-inline">
          <el-cascader
            :options="area"
            v-model="RegaddidEqualss"
            filterable
            :show-all-levels="false"
            change-on-select
          ></el-cascader>
        </div>
      </div>
      <el-button
        type="primary"
        :disabled="downloadLoading"
        @click="btnSearch"
        :loading="this.$store.state.isloading"
      >搜索</el-button>
      <el-button :disabled="this.$store.state.isloading || downloadLoading" @click="btnRepeat">重置</el-button>
    </div>
    <el-tabs v-model="activeName" type="card" style="margin-top:10px;">
      <el-tab-pane label="查询条件" name="search">
        <div class="form-group" :style="{maxHeight:maxHeight+'px'}" style="overflow:auto;">
          <div class="layui-inline">
            <label class="layui-form-label">逝者姓名</label>
            <div class="layui-input-inline">
              <el-input v-model="selectData.RegnameLike" placeholder="请输入逝者姓名"></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">逝者性别</label>
            <div class="layui-input-inline">
              <el-select v-model="selectData.RegsexEquals" filterable>
                <el-option
                  v-for="item in xblxs"
                  :key="item.CODNAME"
                  :label="item.CODALIAS"
                  :value="item.CODNAME"
                ></el-option>
              </el-select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">逝者类型</label>
            <div class="layui-input-inline">
              <el-select v-model="selectData.REGBONETYPEEquals">
                <el-option
                  v-for="item in szlx"
                  :key="item.CODNAME"
                  :label="item.CODALIAS"
                  :value="item.CODNAME"
                ></el-option>
              </el-select>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">家属姓名</label>
            <div class="layui-input-inline">
              <el-input v-model="selectData.ReghandlernameLike" placeholder="请输入家属姓名"></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">联系电话</label>
            <div class="layui-input-inline">
              <el-input v-model="selectData.ReghandlerlinkEquals" placeholder="请输入联系电话"></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">身份证号</label>
            <div class="layui-input-inline">
              <el-input v-model="selectData.RegCardnoEquals" placeholder="请输入身份证号码"></el-input>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">户籍地址</label>
            <div class="layui-input-inline">
              <el-cascader
                :options="areas"
                v-model="RegHouseholeEquals"
                filterable
                :show-all-levels="false"
              ></el-cascader>
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">收费状态</label>
            <div class="layui-input-inline">
              <el-select v-model="selectData.ChdStatusEquals" filterable>
                <el-option
                  v-for="item in xblx"
                  :key="item.Value"
                  :label="item.Text"
                  :value="item.Value"
                ></el-option>
              </el-select>
            </div>
          </div>
          <div class="layui-inline">
              <label class="layui-form-label">死亡原因</label>
              <div class="layui-input-inline">
                <el-cascader :options="cause" v-model="cauinfo" filterable>
                </el-cascader>
              </div>
          </div>
          <div class="layui-inline">
              <label class="layui-form-label">炉型</label>
              <div class="layui-input-inline">
                <el-select v-model="selectData.RegcretypeEquals">
                  <el-option
                    label="不选择"
                    value=""
                  ></el-option>
                  <el-option
                    v-for="item in regCreTypeOptions"
                    :key="item.CodeValue"
                    :label="item.CodeName"
                    :value="item.CodeValue"
                  ></el-option>
                </el-select>
              </div>
          </div>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">结账日期</label>
              <el-date-picker
                style="width:200px"
                v-date
                v-model="selectData.ChddateGreaterAndEquals"
                type="date"
                placeholder="选择日期范围"
              ></el-date-picker>
              <el-date-picker
                style="width:200px"
                v-date
                v-model="selectData.ChddateLessAndEquals"
                type="date"
                placeholder="选择日期范围"
              ></el-date-picker>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">接尸日期</label>
              <el-date-picker
                style="width:200px"
                v-date
                v-model="selectData.RegdateGreaterAndEquals"
                type="date"
                placeholder="选择日期范围"
              ></el-date-picker>
              <el-date-picker
                style="width:200px"
                v-date
                v-model="selectData.RegdateLessAndEquals"
                type="date"
                placeholder="选择日期范围"
              ></el-date-picker>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">年龄段</label>
              <el-input
                style="width:200px"
                v-model="selectData.RegageGreaterAndEquals"
                placeholder="请输入起始年龄"
              ></el-input>
              <el-input
                style="width:200px"
                v-model="selectData.RegageLessAndEquals"
                placeholder="请输入结束年龄"
              ></el-input>
            </div>
          </div>
          <div class="layui-form-item btnCenter">
            <el-button
              type="primary"
              :disabled="downloadLoading"
              @click="btnSearch"
              :loading="this.$store.state.isloading"
            >搜索</el-button>
            <el-button
              :disabled="this.$store.state.isloading || downloadLoading"
              @click="btnRepeat"
            >重置</el-button>
          </div>
        </div>
      </el-tab-pane>
      <el-tab-pane label="查询结果" name="results">
        <div>
          <ul class="toolList">
            <li>
              <el-button
                type="primary"
                :disabled="this.$store.state.isloading"
                @click="exportExcel"
                :loading="downloadLoading"
                style="margin-left:20px;"
              >导出Excel</el-button>
            </li>
            <li
              v-if="btnShow(item.BTNVALUE)"
              v-for="(item, index) in $store.state.btnListCommon"
              @click="operate(item.BTNVALUE)"
            >
              <el-button type="primary" :value="item.BTNSHOWNAME" v-text="item.BTNSHOWNAME"></el-button>
            </li>
          </ul>
        </div>
        <dataTable
          :headList="headList"
          :dataList="dataList"
          :isIndex="true"
          :hiddenPageOrder="false"
          :height="height"
          :pageOrder="pageOrder"
          @pageChange="pageChange"
          @selectRow="selectRow"
        ></dataTable>
        <printmodal ref="printPdf"></printmodal>
        <deadFileSearchreg ref="simpleReg" :orderType="order" @refreshData="getData"></deadFileSearchreg>
        <Appendixlists ref="dialog"></Appendixlists>
        <Appendixlisttwo ref="dialogs"></Appendixlisttwo>
        <cre-proof ref="prints"></cre-proof>
      </el-tab-pane>
    </el-tabs>
    <el-dialog
      title="录音详情"
      :visible.sync="dialogTableVisible"
      :modal-append-to-body="false"
      width="60%"
    >
      <el-table
        ref="multipleTable"
        :data="diechdData"
        tooltip-effect="dark"
        style="width: 100%"
        max-height="450"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="SDGTALKDATEDESC" label="通话日期" width="120"></el-table-column>
        <el-table-column prop="SDGTALKTIMEDESC" label="通话时间" width="120"></el-table-column>
        <el-table-column prop="SDGREMOTECODE" label="对方电话" width="180"></el-table-column>
        <el-table-column prop="read" label="播放录音">
          <template slot-scope="scope">
            <audio :src="scope.row.SDGTALKURL" controls="controls">播放</audio>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="toggleSelection()">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import dataTable from "@/components/Table/DataTable";
import deadFileSearchreg from "./deadFileSearchreg";
import apiBase from "@/api/apiBase.js";
import { ORDER } from "@/const/orderConst.js";
import { formatDate, timeStringToDate } from "@/utils/date.js";
import printmodal from "@/components/Pdf/Print";
import { manage } from "@/mixins/managePage.js";
import { PRINT } from "@/components/Pdf/PDF.js";
import Appendixlists from "../jointPlatform/Appendixlists";
import Appendixlisttwo from "../jointPlatform/Appendixlisttwo";
import creProof from "./creproofDetail";

const INFO = "详情";
const EXPORT = "导出";
const CHANGE = "修改";
const COPY = "打印";
const REPRINT = "补打火化证明";
const REPRINTS = "补打联办单";

export default {
  name: "deadFileSearch",
  mixins: [manage],
  data() {
    return {
      selectData: {
        RegnameLike: null,
        RegsexEquals: null,
        REGBONETYPEEquals: null, //逝者类型
        ReghandlernameLike: null,
        ReghandlerlinkEquals: null,
        RegageGreaterAndEquals: null,
        RegageLessAndEquals: null,
        RegcremationdateGreaterAndEquals: null,
        RegcremationdateLessAndEquals: null,
        RegbussnumLike: null,
        ChddateGreaterAndEquals: null,
        ChddateLessAndEquals: null,
        RegdateGreaterAndEquals: null,
        RegdateLessAndEquals: null,
        RegCardnoEquals: null,
        ChdStatusEquals: null,
        REGCAUSAEquals: null,  
        REGCAUSASONEquals: null,
        RegcretypeEquals: null, // 火化炉查询
      },
      area: [],
      areas: [],
      xblx: [],
      xblxs: [],
      szlx: [],
      cause: [],
      cauinfo: [],
      dataLists: [],
      RegaddidEqualss: [],
      RegHouseholeEquals: [],
      regCreTypeOptions: [],
      diechdData: [],
      activeName: "results",
      maxHeight: 500,
      height: "620",
      downloadLoading: false,
      copyLoading: false,
      dialogTableVisible: false
    };
  },
  methods: {
    exportExcel() {
      var startTime;
      var endTime;
      if (this.selectData.RegcremationdateGreaterAndEquals) {
        startTime = this.selectData.RegcremationdateGreaterAndEquals.toLocaleDateString();
      } else {
        startTime = "空";
      }
      if (this.selectData.RegcremationdateLessAndEquals) {
        endTime = this.selectData.RegcremationdateLessAndEquals.toLocaleDateString();
      } else {
        endTime = "空";
      }
      let headername;
      let addrName;
      if (this.RegaddidEqualss.length == 0) {
        addrName = "全部";
      } else if (this.RegaddidEqualss.length == 1) {
        if (this.RegaddidEqualss[0] == "001") {
          addrName = "全部";
        } else {
          for (var i = 0; i < this.area.length; i++) {
            if (this.area[i].value == this.RegaddidEqualss[0]) {
              addrName = this.area[i].label;
            }
          }
        }
      } else if (this.RegaddidEqualss.length == 2) {
        var copyarea = this.area;
        // copyarea.splice(0,1);
        let addrId = this.RegaddidEqualss[1];
        copyarea.forEach(function(value, index, arr) {
          value.children.forEach(function(v, i, a) {
            if (v.value == addrId) {
              addrName = v.label;
            }
          });
        });
      }
      headername =
        "逝者档案查询" +
        "__" +
        addrName +
        "(" +
        startTime +
        "-" +
        endTime +
        ")";
      if (this.dataList.length === 0) {
        this.$message.error("无导出数据！");
        return;
      }
      this.downloadLoading = true;
      require.ensure([], () => {
        const { export_json_to_excel } = require("@/vendor/Export2Excel");
        export_json_to_excel(this.headList, this.dataLists, headername);
        this.downloadLoading = false;
      });
    },
    toggleSelection(rows) {
      // this.$refs.multipleTable.clearSelection();取消选中
      this.dialogTableVisible = false;
      // this.diechdData = [];
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    //功能操作
    operate(order) {
      console.log(order);
      this.copyLoading = true;
      this.order = order;
      switch (this.order) {
        case INFO:
          this.$refs.simpleReg.open(this.order, this.currentRow.REGID);
          break;
        case EXPORT:
          this.$refs.printPdf.report(PRINT.PDFDEADFILESEARCH, this.getDataC());
          break;
        case CHANGE:
          this.$refs.simpleReg.open(
            this.order,
            this.currentRow.REGID,
            this.currentRow.REGISCHECK
          );
          break;
        case COPY:
          this.$refs.printPdf.report(PRINT.PDFDEADFILESEARCH, this.getDataC());
          this.copyLoading = false;
          break;
        case "录音详情":
          this.diechdData = [];
          this.dialogTableVisible = true;
          this.detailSound();
          break;
        case "打印火化登记表":
          this.$refs.simpleReg.open(this.order, this.currentRow.CHDID);
          break;
        case "打印减免清单":
          this.$refs.printPdf.open(this.order, this.currentRow.CHDID);
          break;
        case "回传附件详情":
          let infodata = null;
          if (this.currentRow.REGLBPRPID == "") {
            infodata = this.currentRow.REGPRPID;
          } else {
            infodata = this.currentRow.REGLBPRPID;
          }
          this.$refs.dialog.operate("附件上传", infodata); //附件详情
          break;
        case "附件上传":
          this.$refs.dialogs.operate("附件上传", this.currentRow.REGID); //附件详情
          break;
        case REPRINT:
          this.title = "补打火化证明";
          if (this.currentRow)
            this.$refs.prints.open(
              this.order,
              this.currentRow.REGID,
              null,
              true
            );
          else alert("尚未选中行");
          break;
        case REPRINTS:
          this.title = "补打联办单";
          if (this.currentRow)
            this.$refs.prints.open(
              this.order,
              this.currentRow.REGID,
              null,
              true
            );
          else alert("尚未选中行");
          break;
        default:
      }
    },
    getCode() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Registration.QueryAllCode,
        res => {
          this.codeList = res.data.content;
          for (var i in this.codeList) {
            switch (this.codeList[i].CTPID) {
              case "性别类型":
                this.xblxs = this.codeList[i].Cods;
                break;
              case "逝者类型":
                this.szlx = this.codeList[i].Cods;
                break;
              default:
            }
          }
        }
      );
    },
    //获取录音详情
    detailSound() {
      let data = {
        SDGPRPID: this.currentRow.REGID
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().SoundRecord.DetailSoundRecord,
        res => {
          this.diechdData = res.data.content.list_SDG;
          for (let index in this.diechdData) {
            this.diechdData[index].SDGTALKDATEDESC = this.diechdData[
              index
            ].SDGTALKDATEDESC;
            this.diechdData[index].SDGTALKTIMEDESC = this.diechdData[
              index
            ].SDGTALKTIMEDESC;
            this.diechdData[index].SDGREMOTECODE = this.diechdData[
              index
            ].SDGREMOTECODE;
            // this.diechdData[index].read = '播放';
          }
        }
      );
    },
    //获取死亡原因
    getCausa() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Code.GetCausa, res => {
        let caudata = res.data.content;
        this.cause = caudata.map(item => ({
          label: item.CAENAME,
          value: item.CAEID,
          children: item.Caus.map(itemCau => ({
            label: itemCau.CAUNAME,
            value: itemCau.CAUID
          }))
        }));
        // if (this.cause[0] && this.cause[0].children[0])
        //   this.cauinfo = [this.cause[0].value, this.cause[0].children[0].value];
      });
    },
    //获取统计条件
    getAddr() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Code.GetAddressMap,
        res => {
          let cardata = res.data.content;
          this.area = cardata.map(item => ({
            value: item.ADDID,
            label: item.ADDNAME,
            ADDLEVEL: item.ADDLEVEL,
            ADDTOPID: item.ADDTOPID,
            children: item.Children.map(itemStr => ({
              value: itemStr.ADDID,
              label: itemStr.ADDNAME,
              ADDLEVEL: itemStr.ADDLEVEL,
              ADDTOPID: itemStr.ADDTOPID
            }))
          }));
          this.area.unshift({
            label: "全部",
            value: "001",
            children: [{ label: "全部", value: null }]
          });
        }
      );
    },
    //获取户籍地址
    getAddress() {
      let data = {};
      apiBase.DoService(data, apiBase.getApiAdress().Code.GetHousehold, res => {
        let cardatas = res.data.content;
        this.areas = cardatas.map(item => ({
          value: item.StaCode,
          label: item.StaName,
          children: item.List_Cty.map(itemStr => ({
            value: itemStr.CtyCode,
            label: itemStr.CtyName,
            children: itemStr.List_Cnt.map(itemCnt => ({
              value: itemCnt.CntCode,
              label: itemCnt.CntName
            }))
          }))
        }));
      });
    },
    //获取收费状态
    getchargetate() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Checkout.GetChdStatuslittle,
        res => {
          this.xblx = res.data.content;
        }
      );
    },
    // 获取火化炉类型
    getRegCreType() {
      apiBase.DoService(
        {},
        apiBase.getApiAdress().Code.GetCremationType,
        res => {
          this.regCreTypeOptions = res.data.content;
        }
      );
    },
    getDataC() {
      let Data = JSON.parse(JSON.stringify(this.selectData));
      if (!this.selectData.RegnameLike) {
        Data.RegnameLike = null;
      }
      if (!this.selectData.RegsexEquals) {
        Data.RegsexEquals = null;
      }
      if (!this.selectData.REGBONETYPEEquals) {
        Data.REGBONETYPEEquals = null;
      }
      if (!this.selectData.ReghandlernameLike) {
        Data.ReghandlernameLike = null;
      }
      if (!this.selectData.RegbussnumLike) {
        Data.RegbussnumLike = null;
      }
      if (!this.selectData.ReghandlerlinkEquals) {
        Data.ReghandlerlinkEquals = null;
      }
      // console.log(this.RegaddidEqualss);
      // if(!this.RegaddidEqualss){
      //   Data.RegaddidEquals = this.RegaddidEqualss;
      // }
      // Data.RegaddidEquals = this.RegaddidEqualss[1];

      if (this.RegaddidEqualss.length == 1) {
        if (this.RegaddidEqualss[0] == "001") {
          Data.AddIdOr = null;
        } else {
          Data.AddIdOr = this.RegaddidEqualss[0];
        }
      } else if (this.RegaddidEqualss.length == 2) {
        Data.AddIdOr = this.RegaddidEqualss[1];
      } else {
        Data.AddIdOr = null;
      }

      // if(this.AddIdOr.length != 0){
      //   Data.AddIdOr = this.AddIdOr[this.AddIdOr.length-1];
      //   if(Data.AddIdOr == '001'){
      //     Data.AddIdOr = null;
      //   }
      // }else{
      //   Data.AddIdOr = null;
      // }

      if (!this.RegHouseholeEquals) {
        Data.RegHouseholeEquals = this.RegHouseholeEquals;
      }
      Data.RegHouseholeEquals = this.RegHouseholeEquals[2];
      Data.RegcremationdateGreaterAndEquals = formatDate(
        Data.RegcremationdateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.RegcremationdateLessAndEquals = formatDate(
        Data.RegcremationdateLessAndEquals,
        "yyyyMMdd"
      );
      Data.ChddateGreaterAndEquals = formatDate(
        Data.ChddateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.ChddateLessAndEquals = formatDate(
        Data.ChddateLessAndEquals,
        "yyyyMMdd"
      );
      Data.RegdateGreaterAndEquals = formatDate(
        Data.RegdateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.RegdateLessAndEquals = formatDate(
        Data.RegdateLessAndEquals,
        "yyyyMMdd"
      );
      let data = {
        PageIndex: -1,
        PageSize: 1000,
        OrderBy: this.pageOrder.orderType,
        OrderByType: this.pageOrder.orderSort,
        Data: Data
      };
      return data;
    },
    getColumns() {
      let data = {};
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Column.GetDeadFileColumns,
        res => {
          this.headList = res.data.content;
        }
      );
    },
    //获取数据
    getData() {
      let Data = JSON.parse(JSON.stringify(this.selectData));
      if (!this.selectData.RegnameLike) {
        Data.RegnameLike = null;
      }
      if (!this.selectData.RegsexEquals) {
        Data.RegsexEquals = null;
      }
      if (!this.selectData.REGBONETYPEEquals) {
        Data.REGBONETYPEEquals = null;
      }
      if (!this.selectData.ReghandlernameLike) {
        Data.ReghandlernameLike = null;
      }
      if (!this.selectData.RegbussnumLike) {
        Data.RegbussnumLike = null;
      }
      if (!this.selectData.ReghandlerlinkEquals) {
        Data.ReghandlerlinkEquals = null;
      }

      if (this.RegaddidEqualss.length == 1) {
        if (this.RegaddidEqualss[0] == "001") {
          Data.AddIdOr = null;
        } else {
          Data.AddIdOr = this.RegaddidEqualss[0];
        }
      } else if (this.RegaddidEqualss.length == 2) {
        Data.AddIdOr = this.RegaddidEqualss[1];
      } else {
        Data.AddIdOr = null;
      }

      if (!this.RegHouseholeEquals) {
        Data.RegHouseholeEquals = this.RegHouseholeEquals;
      }
      Data.RegHouseholeEquals = this.RegHouseholeEquals[2];
      Data.RegcremationdateGreaterAndEquals = formatDate(
        Data.RegcremationdateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.RegcremationdateLessAndEquals = formatDate(
        Data.RegcremationdateLessAndEquals,
        "yyyyMMdd"
      );
      Data.ChddateGreaterAndEquals = formatDate(
        Data.ChddateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.ChddateLessAndEquals = formatDate(
        Data.ChddateLessAndEquals,
        "yyyyMMdd"
      );
      Data.RegdateGreaterAndEquals = formatDate(
        Data.RegdateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.RegdateLessAndEquals = formatDate(
        Data.RegdateLessAndEquals,
        "yyyyMMdd"
      );
      let data = {
        PageIndex: 1,
        PageSize: 1000,
        OrderBy: this.pageOrder.orderType,
        OrderByType: this.pageOrder.orderSort,
        Data: Data
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Registration.QueryDeadFile,
        res => {
          this.dataList = res.data.content.OutData;
          this.activeName = "results";
          this.pageOrder.totalNum = res.data.content.RecordCount;
        }
      );
    },
    //因为展示1000条，打印全部所以要有这个方法。
    getAllData() {
      let Data = JSON.parse(JSON.stringify(this.selectData));
      if (!this.selectData.RegnameLike) {
        Data.RegnameLike = null;
      }
      if (!this.selectData.RegsexEquals) {
        Data.RegsexEquals = null;
      }
      if (!this.selectData.REGBONETYPEEquals) {
        Data.REGBONETYPEEquals = null;
      }
      if (!this.selectData.ReghandlernameLike) {
        Data.ReghandlernameLike = null;
      }
      if (!this.selectData.RegbussnumLike) {
        Data.RegbussnumLike = null;
      }
      if (!this.selectData.ReghandlerlinkEquals) {
        Data.ReghandlerlinkEquals = null;
      }
      if (this.RegaddidEqualss.length == 1) {
        if (this.RegaddidEqualss[0] == "001") {
          Data.AddIdOr = null;
        } else {
          Data.AddIdOr = this.RegaddidEqualss[0];
        }
      } else if (this.RegaddidEqualss.length == 2) {
        Data.AddIdOr = this.RegaddidEqualss[1];
      } else {
        Data.AddIdOr = null;
      }

      if (!this.RegHouseholeEquals) {
        Data.RegHouseholeEquals = this.RegHouseholeEquals;
      }
      Data.RegHouseholeEquals = this.RegHouseholeEquals[1];
      Data.RegcremationdateGreaterAndEquals = formatDate(
        Data.RegcremationdateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.RegcremationdateLessAndEquals = formatDate(
        Data.RegcremationdateLessAndEquals,
        "yyyyMMdd"
      );
      Data.ChddateGreaterAndEquals = formatDate(
        Data.ChddateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.ChddateLessAndEquals = formatDate(
        Data.ChddateLessAndEquals,
        "yyyyMMdd"
      );
      Data.RegdateGreaterAndEquals = formatDate(
        Data.RegdateGreaterAndEquals,
        "yyyyMMdd"
      );
      Data.RegdateLessAndEquals = formatDate(
        Data.RegdateLessAndEquals,
        "yyyyMMdd"
      );
      let data = {
        PageIndex: -1,
        PageSize: 1000,
        OrderBy: this.pageOrder.orderType,
        OrderByType: this.pageOrder.orderSort,
        Data: Data
      };
      apiBase.DoService(
        data,
        apiBase.getApiAdress().Registration.QueryDeadFile,
        res => {
          this.dataLists = res.data.content.OutData;
        }
      );
    },
    btnShow(btn) {
      switch (btn) {
        case "导出":
          return true;
          break;
        case "修改":
          return true;
          break;
        case "打印":
          return true;
          break;
        case "录音详情":
          if (this.currentRow) return true;
          break;
        case "打印火化登记表":
          if (this.currentRow) return true;
          break;
        case "回传附件详情":
          if (this.currentRow) return true;
          break;
        case "附件上传":
          if (this.currentRow) return true;
          break;
        case "补打火化证明":
          if (this.currentRow) return true;
          break;
        case "补打联办单":
          if (this.currentRow) return true;
          break;
        case "打印减免清单":
          if (this.currentRow) return true;
          break;
        default:
          return false;
      }
    },
    //搜索按钮
    btnSearch() {
      this.getData();
      this.getAllData();
      this.$store.state.isloading = true;
    },
    //查询条件重置
    btnRepeat() {
      this.selectData = {
        RegnameLike: null,
        RegsexEquals: null,
        REGBONETYPEEquals: null,
        ReghandlernameLike: null,
        ReghandlerlinkEquals: null,
        RegcremationdateGreaterAndEquals: null,
        RegcremationdateLessAndEquals: null,
        RegbussnumLike: null,
        ChddateGreaterAndEquals: null,
        ChddateLessAndEquals: null,
        RegdateGreaterAndEquals: null,
        RegdateLessAndEquals: null,
        RegCardnoEquals: null,
        ChdStatusEquals: null,
        RegcretypeEquals: null,// 火化炉查询
      };
      this.cauinfo = [];
      this.RegaddidEqualss = [];
      this.RegHouseholeEquals = [];
      this.selectData.RegcremationdateGreaterAndEquals = new Date();
      this.selectData.RegcremationdateGreaterAndEquals.setDate(1);
      this.selectData.RegcremationdateLessAndEquals = new Date();
      var day = new Date();
      var year = day.getFullYear();
      var month = day.getMonth() + 1;
      var d = new Date(year, month, 0);
      var dat = d.getDate();
      this.selectData.RegcremationdateLessAndEquals.setDate(dat);
      this.getData();
    }
  },
  mounted() {},
  components: {
    dataTable,
    deadFileSearchreg,
    printmodal,
    Appendixlists,
    Appendixlisttwo,
    creProof
  },
  created() {
    this.selectData.RegcremationdateGreaterAndEquals = new Date();
    this.selectData.RegcremationdateGreaterAndEquals.setDate(1);
    this.selectData.RegcremationdateLessAndEquals = new Date();
    var day = new Date();
    var year = day.getFullYear();
    var month = day.getMonth() + 1;
    var d = new Date(year, month, 0);
    var dat = d.getDate();
    this.selectData.RegcremationdateLessAndEquals.setDate(dat);
    this.getColumns();
    this.getData();
    this.getAllData();
    this.getAddr();
    this.getCausa();
    this.getAddress();
    this.getchargetate();
    this.getCode();
    this.getRegCreType(); // 获取火化炉类型
  },
  watch: {
      // 死亡原因
    cauinfo: function(val) { 
      this.selectData.REGCAUSAEquals = val[0];
      this.selectData.REGCAUSASONEquals = val[1];
    },
  }
};
</script>

